\appendix

\section{Download, Build and Use}
\label{build_instructions}
\subsection{Requirements to obtain, compile and run our code}
\begin{itemize}
 \item Quake 3
 \subitem A subversion client
 \subitem A C compiler and other build tools:
 \subsubitem The \verb!build-essential! package (Debian, Ubuntu) or equivalent
 on Unix systems
 \subsubitem MS Visual Studio 8 on Windows.
 
 \subitem the \textit{OpenAL} library
 \subitem the \textit{libSDL} library on Unix
 \subitem the \verb!patch! executable (will be standard on most Unix systems
 and can be obtained by installing Cygwin \footnote{\href{http://www.cygwin.org/}{Cygwin homepage} }
 or MSYS \footnote{\href{http://www.mingw.org/msys.shtml}{MSYS homepage} } on Windows)
 \item Graph generator
 \subitem
 Ruby (including \verb!gem!)
 \subitem
 Gruff libary (can be obtained using \verb!gem!)
 \subitem
 ImageMagick and its Ruby bindings (can be obtained using \verb!gem!)
\end{itemize}

\subsection{Step by step instructions}
\subsubsection{Linux/Unix}
\begin{enumerate}
\item
Download the source code:\\
\verb!svn co http://quake3-geneticbot.googlecode.com/svn/trunk quake3-geneticbot!
\item
\verb!cd quake3-geneticbot!
\item
\verb!./setup.sh!\\
This will update our source code if necessary, check out the quake3 source code
from the Icculus project's subversion repository\footnote{\href{http://ioquake3.org/}{Official Icculus Quake3 website} }, and apply our patch to the Icculus quake3 source code.
\item
\verb!./build.sh!\\
This will start a compile of the quake3 source code. If you're on a machine
without \verb!libopenal.so! in \verb!/usr/lib/! or another library path, you can
copy \verb!libopenal.so.0! from \verb!/usr/lib/! to a \verb!lib! directory in
your homedir, and the script will detect that and tell \verb!make! (which runs
the build) to use it.
\item
If the compile succeeded, there should be a ``build'' directory in the
\verb!quake3! subdirectory of the directory you're in. In there, there is a
directory holding the quake3 binary, server binary, and dynamic libraries used
for running quake3 and our module. Change to this directory.
\item
Now you will need to download updated \verb!pk3! files from the official
website. Agree to the license agreement and extract the files to the directory
you're now in. This should extract a bunch of pk3 files to the \verb!baseq3! and
\verb!missionpack! subdirectories of the current directory. \item
Copy the \verb!pak0.pk3! file from an official Quake3 cd-rom to the
\verb!baseq3! subdirectory. If you do not have an official Quake3 cd-rom, you
can use the pak0.pk3 file from the Quake3 demo (available on the official Id
Software Quake3 homepage\footnote{\href{http://www.idsoftware.com/games/quake/quake3-arena/index.php?game\_section=demo}{Quake 3 Arena Demo website}}
)
\item
Now you can start the ioquake3 executable to play some quake3 yourself, or use
the \verb!run.sh! script to run our genetic algorithm mod automatically.
Before starting the game it will remove any data files created during previous
runs, reset all the bot statistics and check if all the libraries exist.
\end{enumerate}

\subsubsection{Windows}
On Windows, you can use a client such as TortoiseSVN
\footnote{\href{http://tortoisesvn.tigris.org/}{TortoiseSVN website}}
to check out the source code. Then you can first run the \verb!setup.bat!, and
then the \verb!build.bat! script. If you have MS Visual Studio 8 installed, this
should build the executable automatically. It should then end up in a \verb!bin!
directory. You will still need to copy the pk3 files to subdirectories here, as
outlined above for Linux/Unix systems. You can then use the \verb!run.bat! file
to start Quake3.

\subsection{Experimenting with Quake3}
You can adjust various settings (such as the number of bots, the number of
rounds, the fitness function used and the mutation and crossover rates) using
the \verb!settings.ini! file found in the \verb!genetic/qvdata! subdirectory of
the directory the Quake3 executable is in.

After Quake3 starts using the \verb!run.sh! or \verb!run.bat! file, you can
create a Multiplayer game, and adjust some other conditions there (such as the
time and frag limit for the games). You can also pick a map (level) to run the
simulation in. After starting the multiplayer game, you may use the \verb!/ts!
command in the Quake3 console to speed up the simulation. A good value to use is
15: \verb!/ts 15!

\subsection{The grapher}
Once the evolution has run its course, it is possible to use the graph
generator we wrote to interpret the results. The values of each of the
characteristics of each of the bots are written to a file after each
round. By using our characteristic interpreter it is possible to generate line
graphs to visualise the changes in the characteristic's values.

In order to do this all the bot files must be copied from the
\textit{genetic/qvdata/genes} subdirectory of the directory the executable is in
to a \verb!genes! subdirectory of the parser directory. The parser directory is
normally the \verb!genes_parser! directory in our code, which you checked out
from our subversion repository. To view a list of available characteristics run
the application as \textit{ruby q3\_parser.rb -list}. Pick the charachteristic
which you want to generate the graph with and run \textit{ruby q3\_parser.rb
-charac=CHARACTERISTIC}, where CHARACTERISTIC is the characteristic you wish to graph. 
You can also choose to just run the \verb!tester.sh! script which will generate graphs
for the five characteristics (Aim Skill, Aim Accuracy, Attack Skill, Reaction
Time and Alertness) that we monitored in our experiments.
